﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PedidoCompraSearch.ascx.cs"
    Inherits="Emporium_Web.PedidoCompraSearch" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

 <script type="text/javascript">
     var hdnSeleccionPedidoCompraId = '<%= this.hdnSeleccion.ClientID %>';


     function CheckPedidoCompraSearch(itemId) {
         Regs = document.getElementById(hdnSeleccionPedidoCompraId);
         Regs.value = itemId;        
     }

     function HayUnoPedidoCompraSeleccionado() {
         Regs = document.getElementById(hdnSeleccionPedidoCompraId);

         if (Regs.value == '') {
             alert('Seleccione un registro');
             return false;
         }
         return true;
     }
</script>

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<div align="left" style="width: 100%; float: left; z-index:155;">
    <asp:TextBox ID="txtCodigoPedidoCompra" runat="server" Width="120px" Enabled = "false" ></asp:TextBox>         
    <asp:Button ID="btnMostrarModal" runat="server" Text="..." OnClick ="btnMostrarModal_Click" CssClass="button" CausesValidation="false"/>    
</div>
</ContentTemplate>
</asp:UpdatePanel>

<asp:Button ID="btnTarget" style="display:none" runat="server" Text="Button" />


<asp:Panel ID="ModalPanelPedidoCompra" runat="server" Width="700px" Height="460px" BackColor="White" style=" z-index:1002; display:none; background-color:White;  " >

<div>
    
    <article class="container_12" >
		<section class="grid_12">

			<div class="block-border" style="background-color:White; z-index:149;">
				<h1>Pedido de Compra</h1>
                <br />
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <div style="width: 100%; padding-top: 0px; background-color:White; z-index:151;">
                        <div style="width: 100%; height: 40px; background-color:White; float: inherit;">
                            <div style="width: 100px; float: left;background-color:White;">
                                <label>Código</label>
                            </div>
                            <div align="left" style="width: 70%; float: left;">
                                <asp:TextBox ID="txtCodigo" name="simple-required" runat="server" Width="120px"></asp:TextBox>
                                  <asp:LinkButton ID="btnBuscar" runat="server" Text="Buscar" CssClass="button red"
                                    OnClick="btnBuscar_Click" />
                            </div>
                        </div>                        
                    </div>

					<ul class="message error no-margin" runat="server" id="errorMessage">
					    <li><asp:Label runat="server" ID="lblErrorMessage"></asp:Label></li>
					</ul>                    

                    <div class="block-controls" style="padding: 10px; background-color:White; z-index:152; margin:0px;">
                    <emporium:pager ID="gvPager" Width="700px"  runat="server" Visible="false" PageSize="5" OnPageChanged="gvPagerPageChanged" />
                    </div>


                    <asp:HiddenField ID="hdnSeleccion" runat="server" />

                    <div class="no-margin" 
                        style=" margin: 0px; padding: 0px; width:100%;">
					<asp:GridView ID="gvPedidoCompras" runat="server" SkinID="gridviewSkin" PageSize="5" AutoGenerateColumns = "false"
                            Width="100%" onsorting="gvPedidoCompras_Sorting" AllowSorting="True" DataKeyNames = "PedCom_Id"
                            onrowcommand="gvPedidoCompras_RowCommand" 
                              >

                            <Columns>                   
							<asp:TemplateField>
                                <ItemTemplate>
                                      <input id="rbSelect" type="radio" name="selectGroup" value="rbSelect" onclick="javascript:CheckPedidoCompraSearch('<%# Eval("PedCom_Id") %>','hdnSeleccionPedidoCompra');"/>
								</ItemTemplate>
								<ItemStyle HorizontalAlign="Left" Width="5%" />
							</asp:TemplateField>
                             <asp:TemplateField>
                                <HeaderStyle HorizontalAlign="Left" ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                <span class="column-sort">
									<asp:LinkButton Name="lnkSortUpId" ID="lnkSortUpId" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Id"/>
                                    <asp:LinkButton Name="lnkSortDownId" ID="lnkSortDownId" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Id"/>
								</span>
                                C&oacute;digo
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("PedCom_Id", "{0:00000}")%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpCliente" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Cliente"/>
                                        <asp:LinkButton ID="lnkSortDownCliente" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Cliente"/>
								    </span>
                                    Cliente
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("TG_Cliente.Nombre")%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpTemporada" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="Temporada"/>
                                        <asp:LinkButton ID="lnkSortDownTemporada" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="Temporada"/>
								    </span>
                                    Temporada
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("TG_Temporada.Descripcion")%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:TemplateField>
                             <asp:TemplateField>
                                <HeaderStyle ForeColor="White" Font-Bold="true"></HeaderStyle>
                                <HeaderTemplate>
                                    <span class="column-sort">
									    <asp:LinkButton ID="lnkSortUpFechaEntrega" CssClass="sort-up" runat="server" CommandName="SortUp" CommandArgument="FechaEntrega"/>
                                        <asp:LinkButton ID="lnkSortDownFechaEntrega" CssClass="sort-down" runat="server"  CommandName="SortDown" CommandArgument="FechaEntrega"/>
								    </span>
                                    F.Entrega
                                </HeaderTemplate>
                                <ItemTemplate>                                    
                                    <%# Eval("PedCom_FechaEntrega", "{0:dd/MM/yyyy}")%>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"/>
                            </asp:TemplateField>
						</Columns> 
						  
						<PagerSettings Visible="false" />
                        
					</asp:GridView> 
                    
                  
                  </div>
                    
                    
                     <ul class="message no-margin" style="  width:650px; margin-left:0px;">
                    <li>
                        <asp:Label ID="lblMensajeGridFooter" runat="server"></asp:Label>
                    </li>
				    </ul>

                    <!-- footer para cerrar el PedidoCompra bien-->
				<div align="left" style="width:100%; left:25px;">
                <asp:Button ID="btnAceptar" runat="server" Text="Aceptar" CssClass="button" 
                        onclick="btnAceptar_Click" OnClientClick="return HayUnoPedidoCompraSeleccionado();"/>
                <asp:Button ID="btnCancelar" runat="server" Text="Cancelar" CssClass="button" />
				</div>

                   </ContentTemplate>
                    </asp:UpdatePanel>

                    
			
			</div>
	
	</section>
                </article>
</div>

    	

</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="mpeBusquedaPedidoCompra" runat="server" TargetControlID="btnTarget"
    PopupControlID="ModalPanelPedidoCompra" CancelControlID = "btnCancelar"
    BackgroundCssClass = "modalBackgroundDiv" DropShadow = "true" />

